// 获取请求接口
import { request } from "../untils/request.js";

// 向请求接口传入请求类型、路径、请求数据
export default {
  // 获取页面数据请求
  get: async ({ curPage=1, eachPage=10 }) =>
    await request({
      type: "GET",
      url: "/api/theaters",
      data: { curPage, eachPage },
    }),
  // 添加放映厅请求
  add: async (theater) =>
    await request({
      type: "POST",
      url: "/api/theaters",
      data: theater,
    }),
  // 获取一个放映厅请求
  getOne: async (_id) =>
    await request({
      type: "GET",
      url: "/api/theaters/getOne",
      data: { _id },
    }),

  // 删除放映厅请求
  del: (_id) =>
    request({
      type: "DELETE",
      url: "/api/theaters",
      data: { _id },
    }),
  // 修改放映厅
  change: (theater) => {
    request({
      type: "PUT",
      url: "/api/theaters",
      data: theater,
    });
  },
  // 查找与影院对应的放映厅
  getMany: cinemasId => 
    request({
      type: "GET",
      url: "/api/theaters/getCinemas",
      data: {cinemasId},
    }),
  

  //  查询放映厅  排片用的
  searchTheater: cinemasId =>
    request({
      url: "/api/theaters/search",
      type: "get",
      data: { cinemasId }
    }),
}



